<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="vue.js"></script>
</head>

<body>
    <div id='root'> 
      <div v-if="show">{{title}}</div>
      <div v-show="show">{{title}}</div>
       <button @click="handleClick">toggle</button>
       <ul>
        <li v-for="item of list">{{item}}</li>

       </ul>
    </div> 

    <script>
        new Vue({
            el: '#root',  //el 挂载点，与id=root的元素绑定  
            data: {  //绑定元素的数据操作    
                title: 'this is hello world',
                show: true,
                list: [1,2,3,4,5]
            },
            methods: {
                handleClick: function(){
                    this.show = !this.show;
                }  
            }
        })

        /**
         *  v-if true新增元素 false删除元素  效率会低
         *  v-show true显示元素  flase隐藏元素 效率高
         *  v-for 循环遍历
         * 
         * */

    </script>
</body>

</html>